var ibMarketFormatter = {
	formatNumber: function(number,includeCurrency)
	{
		number = number + "";
		var a = number.split('.',2);
		var d = this.intval(a[1]);
		var i = this.intval(a[0]);
		var minus = '';
		if(i < 0)
		{
			minus = '-';
		}
		i = Math.abs(i);
		var n = new String(i);
		var a = [];
		while(n.length > 3)
		{
			var nn = n.substr(n.length-3);
			a.unshift(nn);
			n = n.substr(0,n.length-3);
		}
		if(n.length > 0)
		{
			a.unshift(n);
		}
		n = a.join(commaSpace);
		if(d == 0)
		{
			amount = n;
		}
		else
		{
			amount = n + decimal_space + d;
		}
		if(includeCurrency)
		{
			amount = currencyPrefix + amount + currencySuffix;
		}
		amount = minus + amount;
		return amount;
	},
	
	intval: function(number)
	{
		var n = parseInt((number+"").replace(/^0+/,''));
		n = isNaN(n) ? 0 : n;
		
		return n;
	}
}
